package Task28;

import java.util.LinkedList;
import java.util.Scanner;
class Node{
    public int val;
    Node next;
    public Node(int val){
        this.val = val;
    }
}
public class Main3 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()){
            int size = scanner.nextInt();
            int[] array = new int[size];
            for (int i = 0; i < array.length; i++) {
                array[i] = scanner.nextInt();
            }
            Node head = new Node(array[0]);
            Node cur = head;
            for (int i = 1; i < array.length; i++) {
                cur.next = new Node(array[i]);
                cur = cur.next;
            }
            int l = scanner.nextInt();
            int r = scanner.nextInt();
            Node newhead = reverselist(head,l,r);
            for (int i = 0; i < size; i++) {
                System.out.println(newhead.val);
                newhead = newhead.next;
            }
        }
    }
    public static Node reverselist(Node head,int l,int r){

        Node prevHead = new Node(-1);
        prevHead.next = head;
        Node prev = prevHead;
        for (int i = 1;i < l;i++){
            prev = prev.next;
        }
        Node prev2 = prev.next;
        Node prev3 = prev.next;
        Node cur = prev2.next;
        for (int i = l; i < r; i++) {
            Node curNext = cur.next;
            cur.next = prev2;
            prev2 = cur;
            cur = curNext;
            prev3.next = curNext;
        }
        prev.next = prev2;
        return prevHead.next;
    }
}
